import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Category from '@/views/Category'
import CategorySub from '@/views/Category/sub.vue'
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      // 首页
      {
        path: '/',
        component: Home
      },
      // 一级分类页(动态路由)
      {
        path: '/category/:id',
        component: Category
      },
      {
        path: '/category/sub/:id',
        component: CategorySub
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
